package com.libre.view;

import com.libre.view.file.PrintView;
import com.libre.view.help.DocumentView;
import com.libre.view.help.TeamView;
import com.libre.view.setting.SettingView;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

/**
 * 菜单
 */
public class MenuView extends Stage {

    public MenuBar getMenuBar(BorderPane borderPane) {
        MenuBar menuBar = new MenuBar();//创建一个MenuBar类型对象
        // --- Menu File
        Menu menuFile = new Menu("文件");
        MenuItem printMenuItem = new MenuItem("文件打印");
        printMenuItem.setOnAction(event -> new PrintView(borderPane));
        menuFile.getItems().addAll(printMenuItem);
        // --- Menu Edit
        Menu menuEdit = new Menu("菜单");
        // --- Menu View
        Menu menuView = new Menu("设置");
        MenuItem settingMenuItem = new MenuItem("系统设置");
        settingMenuItem.setOnAction(event -> new SettingView(borderPane));
        menuView.getItems().addAll(settingMenuItem);
        // --- Menu Help
        Menu menuHelp = new Menu("帮助");
        MenuItem teamMenuItem = new MenuItem("团队简介");
        teamMenuItem.setOnAction(event -> new TeamView(borderPane));
        MenuItem documentMenuItem = new MenuItem("操作文档");
        documentMenuItem.setOnAction(event -> new DocumentView(borderPane));
        menuHelp.getItems().addAll(teamMenuItem, documentMenuItem);
        menuBar.getMenus().addAll(menuFile, menuEdit, menuView, menuHelp);//Menu类型对象都是要镶嵌在MenuBar对象上的
        return menuBar;
    }

}
